<template>
	<div class="start" @touchstart="start" @touchend="end">
		<view class="headImg headImg3"></view>
		<view class="box">
			<view class="title titleColorGrade">查询成绩</view>
			<view class="text">
				<text class="study">自律学习</text>
				<text>成绩我有</text>
			</view>
			<view>
				<button type="default" form-type="submit" class="loginBtn">立即体验</button>
			</view>
		</view>
		<view class="footImg footImg3"></view>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				startData: {
					clientX: 0,
					clientY: 0
				}
			}
		},
		methods:{
			start(e){
			    this.startData.clientX=e.changedTouches[0].clientX;
			    this.startData.clientY=e.changedTouches[0].clientY;
			},
			end(e){
			    // console.log(e)
			    const subX=e.changedTouches[0].clientX-this.startData.clientX;
			    const subY=e.changedTouches[0].clientY - this.startData.clientY;
			    if(subY>50 || subY<-50){
			        console.log('上下滑')
			    }else{
			        if(subX>100){
			            console.log('右滑');
						uni.navigateTo({
							url: 'pay'
						});
			        }else if(subX<-100){
			            console.log('左滑');
			        }else{
			            console.log('无效');
						uni.navigateTo({
							url: '../login/welcome'
						});
			        }
			    }
			}
		}
	}
</script>

<style scoped src="../../static/css/start.css"></style>
